﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Bovril.Rodney.Core
{
    internal class Event : IEvent
    {
        internal Event(ServiceClient serviceClient, int id, String name)
            : this(serviceClient, id, name, null)
        {
        }

        internal Event(ServiceClient serviceClient, int id, String name, IEvent parent)
        {
            serviceClient_ = serviceClient;

            ID = id;

            Name = name;
            Parent = parent;
        }

        public override string ToString()
        {
            return String.Format("'{0}' ({1})", Name, ID);
        }

        public IEvent[] GetChildEvents()
        {
            return serviceClient_.GetChildEvents(this);
        }

        public ICouponLink[] GetCouponLinks()
        {
            return serviceClient_.GetCouponLinks(this);
        }

        public IMarketSummary[] GetMarketSummaries()
        {
            return serviceClient_.GetMarketSummaries(this);
        }

        public String Name { get; private set; }
        public IEvent Parent { get; private set; }

        internal int ID { get; private set; }

        private ServiceClient serviceClient_;
    }
}
